<?php
$where_item = "";
if (isset($_GET['var2']))
    $where_item = " where titleurl = '" . $_GET['var2'] . "' ";

$re_item = $db->select("select * from recruitment_item $where_item  order by orderId asc, id asc limit 1 ");
$tt_item = $db->fetch($re_item);

//get cat
$tt_cat = $db->fetch($db->select("select * from recruitment_cat where id = ".$tt_item['idcat']." limit 1 "));

//get other recruitment
$sql_list = "select * from recruitment_item where id NOT IN ( " . $tt_item['id'] . " ) and idcat=".$tt_cat['id']." order by orderId, id desc limit 4";
$qr_list = $db->select($sql_list);
?>


<div class="left-col">
    <div class="title"><?= $co_recruitment['titlemenu' . $hg] ?></div>
    <ul class="pl-list">
        <?php
        $re_list = $db->select("select * from recruitment_cat order by orderId asc ");
        while ($tt_list = $db->fetch($re_list)) {
            if ($act == "recruitment-detail" && $tt_list['id'] == $tt_cat['id'])
                $subClass = "active";
            else
                $subClass = "";
            ?>
            <li class="<?= $subClass ?>">
                <a href="<?= APPLICATION_URL ?>recruitment/<?= $tt_list['titleurl'] ?>.html"><?= $tt_list['title' . $hg] ?></a>
                <div class="clear"></div>
            </li>		
            <?php
        }
        ?>		
    </ul>
    
</div>
<div class="right-col">
    <div class="title"><?= $tt_cat['title' . $hg] ?></div>
    <div class="intro content-text">
        <div class="item-title"><?= $tt_item['title' . $hg] ?></div>
        <div class="text">
            <?= $tt_item['content' . $hg] ?>
        </div>
    </div>
    
    <div class="other">
            <div class="tit" ><?= ($hg == "") ? 'Latest news' : 'Tin mới nhất' ?></div>
            <ul>
                <?php
                while ($tt_list_other = $db->fetch($qr_list)) {
                    ?>
                    <li><a href="<?= APPLICATION_URL ?>recruitment-detail/<?= $tt_list_other['titleurl'] ?>.html"><?= $tt_list_other['title' . $hg] ?></a></li>
                    <?php
                }
                ?>
            </ul>
        </div>
</div>